﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

namespace Abp.PlugIns
{
    /// <summary>
    /// 插件源
    /// </summary>
    public class PlugInSourceList : List<IPlugInSource>
    {
        /// <summary>
        /// 获取所有程序集
        /// </summary>
        /// <returns></returns>
        public List<Assembly> GetAllAssemblies()
        {
            return this
                .SelectMany(pluginSource => pluginSource.GetAssemblies())
                .Distinct()
                .ToList();
        }
        /// <summary>
        /// 获取所有类型
        /// </summary>
        /// <returns></returns>
        public List<Type> GetAllModules()
        {
            return this
                .SelectMany(pluginSource => pluginSource.GetModulesWithAllDependencies())
                .Distinct()
                .ToList();
        }
    }
}